﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AutomatedTP
{
    /// <summary>
    /// Class for storing information about function.
    /// </summary>
    public class Func
    {        
        private Dictionary<string, string> input;
        public string func_type { get; set; }
        public string name { get; set; }
        public int num_of_param { get; set; }
        public string ret_type { get; set; }
        public string ret_val { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="Func"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        public Func(string name)
        {
            this.name = name;
            this.input = new Dictionary<string, string>();
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Func"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="func_type">The func_type.</param>
        /// <param name="ret_val">The ret_val.</param>
        /// <param name="ret_type">The ret_type.</param>
        /// <param name="num_of_param">The num_of_param.</param>
        /// <param name="input">The input.
        /// pair.key = name of variable
        /// pair.value = type of variable
        /// </param>
        public Func(string name,string func_type , string ret_val, string ret_type, int num_of_param, Dictionary<string, string> input)
        { 
            this.name = name;
            this.func_type = func_type;
            this.ret_val = ret_val;
            this.ret_type = ret_type;
            this.num_of_param = num_of_param;
            this.input = new Dictionary<string, string>();
            
            if (input != null)
            {
                foreach (var pair in input)
                {                    
                    this.AddInput(pair);
                }
            }
        }

        /// <summary>
        /// Adds the input.
        /// </summary>
        /// <param name="pair">The pair.
        /// pair.key = name of variable
        /// pair.value = type of variable
        /// </param>
        public void AddInput(KeyValuePair<string, string> pair)
        {
            input.Add(pair.Key, pair.Value);
        }

        /// <summary>
        /// Gets the input.
        /// </summary>
        /// <returns></returns>
        public Dictionary<string, string> GetInput()
        {
            return input;
        }
    }
}
